<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.Date"%>
<%@ page import="com.joinway.framework.admin.web.constant.AdminWebConstants"%>
<%@ page import="com.joinway.framework.admin.bean.domain.AdminUser" %>
<%@ page import="com.joinway.framework.admin.bean.UserContext" %>
<%@ page import="org.apache.commons.lang3.time.DateFormatUtils" %>
<%
UserContext context = (UserContext)session.getAttribute(AdminWebConstants.USER_CONTEXT_KEY);
AdminUser user = context.getUser();
Date lastTime = user.getLastLoginTime();
String time = lastTime != null ? DateFormatUtils.format(lastTime, "yyyy年MM月dd日 HH时mm分ss秒") : "(无)";
%>
<link rel="stylesheet" type="text/css" href="resources/css/header.css">
<script type="text/javascript">
$(function(){
	refreshHeader(<%=user.getId()%>);
});

function logout(){
	showConfirmMessage('是否要退出系统？', function(r){
		if(r){
			window.location.href = 'logout.jspx';
		}
	});
}
</script>
<div class="headBg">
  <div class="logo"></div>
  <div class="time">欢迎<strong id="headbar_user_name"></strong>！您是第<%=user.getLoginCount()%>次登录，上次登录时间<%=time%>
</div>
<div class="headRight">
  <span class="power"><a href="javascript:void(0)" onclick="logout()" style="color:white">安全退出</a></span>
  <span class="powerIcon"></span>
  <span class="user2"><strong>用户权限：</strong><span id="headbar_user_role"></span></span>
  <span class="userIcon"></span>
</div>
</div>